home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_riv_bordergate.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  332 lines

  1. # Jones 3D Cog Script
  2. #
  3. # RIV_BorderGate.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     user0
  15.     message     entered
  16.     message     exited
  17.     message     activated
  18.  
  19.     thing       player          local
  20.     thing       pushed          local
  21.     thing       pulled          local
  22.     
  23.     thing       indy
  24.     thing       brdr_Gate
  25.     thing       lever_Pos
  26.     thing       offsetCam
  27.     thing       lever_Look
  28.     thing       gate_Look
  29.     thing       block1
  30.     thing       block2
  31.     
  32.     thing       invisi1
  33.     thing       invisi2
  34.     
  35.     surface     surf0       linkID=1
  36.     
  37.     template    tplLevPull=pullever         local
  38.     template    tplLevPush=pushlever        local
  39.     template    tpl_Indy=indy_actor         local
  40.     
  41.     keyframe    leverPull=gen_lever_pull.key        local
  42.     keyframe    leverPush=gen_lever_push.key        local
  43.     
  44.     keyframe    indyPull=in_pull_lever.key          local
  45.     keyframe    indyPush=in_push_lever.key          local
  46.     
  47.     sound       sndLever=gen_lever_pull.wav             local
  48.     sound       snd_Gate=shs_belldoors_open.wav         local
  49.     sound       snd_Close=shs_belldoors_close.wav       local
  50.     
  51.     flex        pullLever           local
  52.     flex        pushLever           local
  53.     
  54.     int         onSpot=0            local
  55.     int         lever_Ready=1       local
  56.     
  57. end
  58.  
  59. # ========================================================================================
  60.  
  61. code
  62.  
  63. startup:
  64.  
  65.     pushed = CreateThing(tplLevPull, lever_Pos);
  66.     CaptureThing(pushed);
  67.     
  68.     player = GetLocalPlayerThing();
  69.     
  70.     # hide invisiplates
  71.     SetThingFlags(invisi1, 0x80000);
  72.     SetThingFlags(invisi2, 0x80000);
  73.     
  74.     # open the gate
  75.     SetCollideType(brdr_Gate, 0);
  76.     SetCollideType(block1, 0);
  77.     SetCollideType(block2, 0);
  78.     Rotate(brdr_Gate, -65, 2, 2.0);
  79.     WaitForStop(brdr_Gate);
  80.     SetCollideType(brdr_Gate, 3);
  81.     SetCollideType(block1, 3);
  82.     SetCollideType(block2, 3);
  83.     
  84.     return;
  85.     
  86. # ========================================================================================
  87.  
  88. user0:
  89.  
  90.     # close the gate
  91.     SetCollideType(brdr_Gate, 0);
  92.     SetCollideType(block1, 0);
  93.     SetCollideType(block2, 0);
  94.     
  95.     PlaySoundThing(snd_Gate, brdr_Gate, 1.0, 10.0, 25.0, 0);
  96.     Rotate(brdr_Gate, 65, 2, 2.0);
  97.     
  98.     Sleep(1.0);
  99.     PlaySoundThing(snd_Close, brdr_Gate, 1.0, 10.0, 25.0, 0);
  100.     
  101.     WaitForStop(brdr_Gate);
  102.     SetCollideType(brdr_Gate, 3);
  103.     SetCollideType(block1, 3);
  104.     SetCollideType(block2, 3);
  105.     
  106.     # show invisiplates
  107.     ClearThingFlags(invisi1, 0x80000);
  108.     ClearThingFlags(invisi2, 0x80000);
  109.     
  110.     return;
  111.     
  112. # ========================================================================================
  113.  
  114. entered:
  115.  
  116.     if(GetSenderID() == 1)
  117.     {
  118.         onSpot = 1;
  119.     }
  120.     
  121.     return;
  122.     
  123. # ========================================================================================
  124.  
  125. exited:
  126.  
  127.     if((GetSenderID() == 1) && (GetSourceRef() == player))
  128.     {
  129.         onSpot = 0;
  130.     }
  131.     
  132.     return;
  133.     
  134. # ========================================================================================
  135.  
  136. activated:
  137.  
  138.     if((GetSenderRef() == pushed) && (lever_Ready == 1) && (onSpot == 1))
  139.     {
  140.         Call pullLever;
  141.     }
  142.     
  143.     else if((GetSenderRef() == pulled) && (lever_Ready == 1) && (onSpot == 1))
  144.     {
  145.         Call pushLever;
  146.     }
  147.  
  148.     return;
  149.     
  150. # ========================================================================================
  151.  
  152. pullLever:
  153.  
  154.     # do cutscene stuff
  155.     MakeMeStop();
  156.     
  157.     # put away any weapon
  158.     DeselectWeaponWait(player);
  159.     StartCutscene(2);
  160.     
  161.     # outfit Indy actor
  162.     CopyPlayerHolsters(player, indy);
  163.     
  164.     # switch to offsetCam
  165.     SetCameraFocus(2, offsetCam);
  166.     SetCameraSecondaryFocus(2, lever_Look);
  167.     SetCurrentCamera(2);
  168.     SetCameraFOV(90, 0, 0.0);
  169.     
  170.     # show actor hide player
  171.     SetThingFlags(player, 0x80000);
  172.     ClearThingFlags(indy, 0x80000);
  173.     
  174.     # pull the lever
  175.     PlayKey(pushed, leverPull, 4, 0x14, 0);
  176.     PlayKey(indy, indyPull, 4, 0x12, 0);
  177.     Sleep(0.75);
  178.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  179.     
  180.     # set camera interp speed turn on look interp
  181.     SetCameraInterpSpeed(2, 2.0);
  182.     SetCameraLookInterp(2, 1);
  183.     Sleep(0.01);
  184.     
  185.     # interp to gate_Look
  186.     SetCameraSecondaryFocus(2, gate_Look);
  187.     
  188.     Sleep(1.5);
  189.     
  190.     # open the gate
  191.     SetCollideType(brdr_Gate, 0);
  192.     SetCollideType(block1, 0);
  193.     SetCollideType(block2, 0);
  194.     PlaySoundThing(snd_Gate, brdr_Gate, 1.0, 10.0, 25.0, 0);
  195.     Rotate(brdr_Gate, -65, 2, 2.0);
  196.     WaitForStop(brdr_Gate);
  197.     SetCollideType(brdr_Gate, 3);
  198.     SetCollideType(block1, 3);
  199.     SetCollideType(block2, 3);
  200.     
  201.     # hide invisiplates
  202.     SetThingFlags(invisi1, 0x80000);
  203.     SetThingFlags(invisi2, 0x80000);
  204.     
  205.     # interp back to lever_Look
  206.     SetCameraSecondaryFocus(2, lever_Look);
  207.     
  208.     Sleep(2.0);
  209.     
  210.     # Destroy old lever and create a new one
  211.     DestroyThing(pushed);
  212.     pulled = CreateThing(tplLevPush, lever_Pos);
  213.     CaptureThing(pulled);
  214.     
  215.     # stop any unfinished animations
  216.     ResetThing(indy);
  217.     
  218.     #Sleep(1.0);
  219.     
  220.     # show player and return controls
  221.     SetThingFlags(indy, 0x80000);
  222.     ClearThingFlags(player, 0x80000);
  223.     ClearActorFlags(player, 0x200000);
  224.     
  225.     # turn off look interp
  226.     SetCameraLookInterp(2, 0);
  227.     Sleep(0.01);
  228.     
  229.     # return camera to player
  230.     SetCameraPosition(1, GetThingPos(offsetCam));
  231.     SetCurrentCamera(1);
  232.     
  233.     EndCutscene();
  234.     
  235.     lever_Ready = 1;
  236.     
  237.     return;
  238.  
  239. # ========================================================================================
  240.  
  241. pushLever:
  242.  
  243.     # do cutscene stuff
  244.     StartCutscene(2);
  245.     MakeMeStop();
  246.     StopThing(player);
  247.     
  248.     # outfit indy actor
  249.     CopyPlayerHolsters(player, indy);
  250.     
  251.     # switch to offsetCam
  252.     SetCameraFocus(2, offsetCam);
  253.     SetCameraSecondaryFocus(2, lever_Look);
  254.     SetCurrentCamera(2);
  255.     SetCameraFOV(90, 0, 0.0);
  256.     
  257.     # show actor hide player
  258.     SetThingFlags(player, 0x80000);
  259.     ClearThingFlags(indy, 0x80000);
  260.     
  261.     # push the lever
  262.     PlayKey(pulled, leverPush, 4, 0x14, 0);
  263.     PlayKey(indy, indyPush, 4, 0x12, 0);
  264.     Sleep(0.85);
  265.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  266.     
  267.     # set camera interp speed turn on look interp
  268.     SetCameraInterpSpeed(2, 2.0);
  269.     SetCameraLookInterp(2, 1);
  270.     Sleep(0.01);
  271.     
  272.     # interp to gate_Look
  273.     SetCameraSecondaryFocus(2, gate_Look);
  274.     
  275.     Sleep(1.5);
  276.     
  277.     # close the gate
  278.     SetCollideType(brdr_Gate, 0);
  279.     SetCollideType(block1, 0);
  280.     SetCollideType(block2, 0);
  281.     PlaySoundThing(snd_Gate, brdr_Gate, 1.0, 10.0, 25.0, 0);
  282.     Rotate(brdr_Gate, 65, 2, 2.0);
  283.     
  284.     Sleep(1.0);
  285.     PlaySoundThing(snd_Close, brdr_Gate, 1.0, 10.0, 25.0, 0);
  286.     
  287.     WaitForStop(brdr_Gate);
  288.     SetCollideType(brdr_Gate, 3);
  289.     SetCollideType(block1, 3);
  290.     SetCollideType(block2, 3);
  291.     
  292.     # show invisiplates
  293.     ClearThingFlags(invisi1, 0x80000);
  294.     ClearThingFlags(invisi2, 0x80000);
  295.     
  296.     # interp back to lever_Look
  297.     SetCameraSecondaryFocus(2, lever_Look);
  298.     
  299.     Sleep(2.0);
  300.     
  301.     # Destroy old lever and create a new one
  302.     DestroyThing(pulled);
  303.     pushed = CreateThing(tplLevPull, lever_Pos);
  304.     CaptureThing(pushed);
  305.     
  306.     # stop any unfinished animations
  307.     ResetThing(indy);
  308.     
  309.     #Sleep(1.0);
  310.     
  311.     # show player and return controls
  312.     SetThingFlags(indy, 0x80000);
  313.     ClearThingFlags(player, 0x80000);
  314.     ClearActorFlags(player, 0x200000);
  315.     
  316.     # turn off look interp
  317.     SetCameraLookInterp(2, 0);
  318.     Sleep(0.01);
  319.     
  320.     # return camera to player
  321.     SetCameraPosition(1, GetThingPos(offsetCam));
  322.     SetCurrentCamera(1);
  323.     
  324.     EndCutscene();
  325.     
  326.     return;
  327.  
  328. # ========================================================================================
  329.  
  330. end
  331.  
  332.